
from web.utils.bootstrap import BootStrapForm
from django import forms
from web import models


class WikiModelForm(BootStrapForm, forms.ModelForm):
    # parent = forms.ModelChoiceField(
    #     queryset=models.Wiki.objects.filter(project=request.tracer_obj.project)
    # )
    class Meta:
        model = models.Wiki
        exclude = ['project', 'depth']

    def __init__(self, request, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.request = request
        #
        self.fields['parent'].queryset = models.Wiki.objects.filter(project=self.request.tracer_obj.project)




